package com.evil.kingdom.pojo.dto.person.king;

import com.evil.kingdom.pojo.dto.person.base.PersonTypeDto;
import com.evil.kingdom.pojo.dto.person.base.PersonDto;
import com.evil.kingdom.pojo.dto.person.general.GeneralDto;
import com.evil.kingdom.pojo.dto.person.soldier.SoldierDto;
import com.evil.common.mongo.entity.SingleName;
import lombok.Getter;
import lombok.Setter;

import java.util.HashSet;
import java.util.Objects;
import java.util.Set;

/**
 * 君主
 *
 * @author liyang
 * @date 2024-06-04 18:18
 */
@Getter
@Setter
public class KingDto extends PersonDto implements SingleName, PersonTypeDto {

    /**
     * 武将列表
     */
    private Set<SoldierDto> soldierSet;

    /**
     * 武将列表
     */
    private Set<GeneralDto> generalSet;

    public KingDto() {
        this.soldierSet = new HashSet<>();
        this.generalSet = new HashSet<>();
    }

    @Override
    public String getEntityName() {
        return "君主";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        KingDto that = (KingDto) o;

        return Objects.equals(this.getName(), that.getName());
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}
